package com.mxpio.erp.mes.controller;

import com.mxpio.erp.common.mes.pojo.Aoi;
import com.mxpio.erp.common.mes.pojo.Spi;
import com.mxpio.erp.common.mes.service.AoiMainService;
import com.mxpio.erp.common.mes.service.SpiMainService;
import com.mxpioframework.common.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : wpp
 * @Datetime : 2023/9/1 11:30
 * @Desc :
 * @Modor :  Modifytime:
 * @modDesc :
 */
@Tag(name = "DataLinkController", description = "DataLink同步接口")
@RestController
@RequestMapping("/erp/mes/dl/")
public class DataLinkController {

    @Autowired
    private AoiMainService aoiMainService;

    @Autowired
    private SpiMainService spiMainService;
    @RequestMapping("aoisave")
    @Operation(summary = "aoi数据同步", description = "aoi数据同步")
    public Result<?> saveAoi(@RequestBody List<Aoi> jsonObjMap) {
        System.out.println(jsonObjMap);
        return aoiMainService.saveFromDl(jsonObjMap);
    }

    @RequestMapping("spisave")
    @Operation(summary = "spi数据同步", description = "spi数据同步")
    public Result<?> saveSpi(@RequestBody List<Spi> jsonObjMap) {
        System.out.println(jsonObjMap);
        return spiMainService.saveFromDl(jsonObjMap);
    }
}
